import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state:{
    isLogin: false,
    userName: '',
    userPhoto: ''
  },
  mutations: {
    login (state, payload) {
      state.userName = payload.userName,
      state.isLogin = payload.isLogin,
      state.userPhoto = payload.userPhoto
    }
  },
  actions: {
    actionChange (context, payload) {
      setTimeout(() => {
        context.commit('login', payload)
      }, 0)
    }
  }
})

export default store
